import http from "@/plugins/http";

class WxGate {
  constructor() {
    this.basic_url = "/wx-gate";
  }

  add(obj, then) {
    http.post(this.basic_url, obj, then);
  }

  update(obj, then) {
    http.put(this.basic_url, obj, then);
  }

  query(then) {
    http.get(this.basic_url, then);
  }

  del(id, then) {
    http.del(this.basic_url + "/" + id, then);
  }

  getQrCode(id, then) {
    http.get(this.basic_url + "/" + id, then);
  }

  resetQrCode(id, then) {
    http.get(this.basic_url + "/reset/" + id, then);
  }

  getDoorList(page, pageSize, then, err) {
    http.get(
      this.basic_url +
        "/door-list" +
        http.makeParams({
          page: page,
          pageSize: pageSize
        }),
      then,
      err
    );
  }
}

export default WxGate;
